package org.zhxy.zhxy.controller.front;



import org.zhxy.zhxy.entity.Notice;
import org.zhxy.zhxy.service.NoticeService;
import org.springframework.web.bind.annotation.*;
import org.zhxy.zhxy.utils.Result;

import javax.annotation.Resource;
import java.util.List;

/**
 * 公告表(Notice)表控制层
 *
 * @author yayong
 * @since 2024-10-19 21:27:34
 */
@RestController
@RequestMapping("/api/notice")
public class NoticeController {

/**
 * 服务对象
 */
@Resource
private NoticeService noticeService;

//查询公告列表
    @GetMapping("/list")
    public Result listNotice() {
    List<Notice> res =  noticeService.selectList();
       return Result.success(res);
    }
    /**
     * 根据公告id查询公告详情
     */
    @GetMapping("/query-by-id")
    public Result queryById(@RequestParam("id") Integer id) {
        return Result.success(noticeService.getById(id));
    }
}

